package com.panghl.controller;

import com.panghl.test01.service.UserService01;
import com.panghl.test02.service.UserService02;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

/**
 * @Author panghl
 * @Date 2022/2/16
 **/
@RestController
@RequestMapping("")
public class UserController {

    @Autowired
    @Qualifier("userService01")
    private UserService01 userService01;
    @Autowired
    @Qualifier("userService02")
    private UserService02 userService02;

    @GetMapping("/insertUserTest01")
    public Integer insertUserTest01(String name,String password,Integer age){
        return userService01.insert(name,password,age);
    }

    @GetMapping("/insertUserTest02")
    public Integer insertUserTest02(String name,String password,Integer age){
        return userService02.insert(name,password,age);
    }

    //测试分布式事务
    @GetMapping("/insertUserTest01AndTest02")
    public Integer insertUserTest01AndTest02(String name,String password,Integer age){
        return userService02.insertUserTest01AndTest02(name,password,age);
    }
}
